using System;
using System.Configuration;
using BoxBinary.AspectCache.Core.PolicyDefinition;

namespace BoxBinary.AspectCache.Core.ConfigurationMappers
{
    /// <summary>
    /// A cache category configuration element.
    /// </summary>
    [Serializable]
    public class PolicyGovernanceDefaults : ConfigurationElement
    {
        public PolicyGovernanceDefaults()
        {
        }

        /// <summary>
        /// <para>Gets or sets the maximum number of minutes a cache entry will be cached (unless <see cref="CacheItemFootprint.NilChangeFrequency"/> is specified in the <see cref="CachePolicySpecification.Footprint"/>),
        /// which is the <code>maxCacheMinutes</code> attribute of the configuration file.</para>
        /// <para>The default value is <value>300</value></para>
        /// </summary>
        [ConfigurationProperty("maxCacheMinutes", DefaultValue = 300, IsKey = false,
            IsRequired = false)]
        public int MaxCacheMinutes
        {
            get { return ((int)(base["maxCacheMinutes"])); }
            set { base["maxCacheMinutes"] = value; }
        }

        /// <summary>
        /// <para>Gets or sets the median number of minutes a cache entry will be cached (unless <see cref="CacheItemFootprint.NilChangeFrequency"/> is specified in the <see cref="CachePolicySpecification.Footprint"/>),
        /// which is the <code>medCacheMinutes</code> attribute of the configuration file.</para>
        /// <para>The default value is <value>60</value></para>
        /// </summary>
        [ConfigurationProperty("medCacheMinutes", DefaultValue = 60, IsKey = false,
            IsRequired = false)]
        public int MedCacheMinutes
        {
            get { return ((int)(base["medCacheMinutes"])); }
            set { base["medCacheMinutes"] = value; }
        }

        /// <summary>
        /// <para>Gets or sets the least number of minutes a cache entry will be cached (unless <see cref="CacheItemFootprint.NilChangeFrequency"/> is specified in the <see cref="CachePolicySpecification.Footprint"/>),
        /// which is the <code>minCacheMinutes</code> attribute of the configuration file.</para>
        /// <para>The default value is <value>20</value></para>
        /// </summary>
        [ConfigurationProperty("minCacheMinutes", DefaultValue = 20, IsKey = false,
            IsRequired = false)]
        public int MinCacheMinutes
        {
            get { return ((int)(base["minCacheMinutes"])); }
            set { base["minCacheMinutes"] = value; }
        }
    }
}